local skel = fk.CreateSkill {
  name = "emo__jishe",
}

Fk:loadTranslationTable{
  ["emo__jishe"] = "极奢",
  [":emo__jishe"] = "出牌阶段限一次，你可以令当前的黑色/红色手牌视为【铁索连环】/【无中生有】，若如此做，本回合你手牌上限为0。",

  ["#emo__jishe"] = "极奢：你可以令当前的黑色/红色手牌视为【铁索连环】/【无中生有】",

  ["$emo__jishe1"] = "孙吴正当盛世，兴些土木又何妨？",
  ["$emo__jishe2"] = "当再建新殿，扬我国威！",
}

skel:addEffect("active", {
  anim_type = "drawcard",
  prompt = "#emo__jishe",
  card_num = 0,
  target_num = 0,
  can_use = function(self, player)
    return player:usedSkillTimes(skel.name, Player.HistoryPhase) == 0 and not player:isKongcheng()
  end,
  times = function (self, player)
    return 1 - player:usedSkillTimes(skel.name, Player.HistoryPhase)
  end,
  card_filter = Util.FalseFunc,
  on_use = function(self, room, effect)
    local player = effect.from
    for _, id in ipairs(player:getCardIds("h")) do
      local color = Fk:getCardById(id).color
      if color ~= Card.NoColor then
        if color == Card.Red then
          room:setCardMark(Fk:getCardById(id), "emo__jishe-inhand", "ex_nihilo")
        elseif color == Card.Black then
          room:setCardMark(Fk:getCardById(id), "emo__jishe-inhand", "iron_chain")
        end
      end
    end
    room:setPlayerMark(player, "emo__jishe-turn", 1)
    player:filterHandcards()
  end,
})

skel:addEffect("filter", {
  mute = true,
  card_filter = function(self, card, player)
    return table.contains(player:getCardIds("h"), card.id) and card:getMark("emo__jishe-inhand") ~= 0
  end,
  view_as = function(self, player, card)
    local c = Fk:cloneCard(card:getMark("emo__jishe-inhand"), card.suit, card.number)
    c.skillName = skel.name
    return c
  end,
})

skel:addEffect("maxcards", {
  fixed_func = function (self, player)
    if player:getMark("emo__jishe-turn") ~= 0 then
      return 0
    end
  end,
})

return skel
